#ifndef __ADCFUNCTION_H__
#define __ADCFUNCTION_H__
#include <stdio.h>
#include <math.h>
#include <string.h>
//#define ADC1 1
//#define ADC2 2
double getadcdata(int adc_id)
{
    FILE *fp = NULL;
    
    int i = 0;
    
    fp=fopen("/sys/bus/iio/devices/iio:device0/in_voltage3_raw","r");
    

    char data[6];
    fscanf(fp,"%s",data);//读取字符串
    i = strlen(data);
    double out=0;
    for(int p = 0;p<i;p++)
    {
        out += (double)(data[i-1-p]-48)*pow(10.0,p);
    }
    out /= 10;
    
    out *= 0.48875;

    
    return out;
}
#endif
